﻿//  Copyright (c) 2009 Ray Liang (http://www.dotnetage.com)
//  Dual licensed under the MIT and GPL licenses:
//  http://www.opensource.org/licenses/mit-license.php
//  http://www.gnu.org/licenses/gpl.html
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DNA.Mvc.jQuery
{
    /// <summary>
    /// Defines the resizable plugin options.
    /// </summary>
    public class ResizableOptions
    {
        /// <summary>
        /// Gets/Sets the resize these elements synchronous when resizing.
        /// </summary>
        [jQueryOption("alsoResize")]
        public string AlsoResize { get; set; }

        /// <summary>
        /// Gets/Sets whether enable animates to the final size after resizing.
        /// </summary>
        [jQueryOption("animate")]
        public bool? EnabledAnimation { get; set; }

        /// <summary>
        /// Gets/Sets duration time for animating, in milliseconds.
        /// </summary>
        [jQueryOption("animateDuration")]
        public int? AnimateDuration { get; set; }

        /// <summary>
        /// Gets/Sets the easing effect for animating.
        /// </summary>
        [jQueryOption("animateEasing")]
        public string AnimateEasing { get; set; }

        /// <summary>
        /// Gets/Sets resizing is constrained by the original aspect ratio. Otherwise a custom aspect ratio
        /// can be specified, such as 9 / 16, or 0.5.
        /// </summary>
        [jQueryOption("aspectRatio")]
        public float? AspectRatio { get; set; }

        /// <summary>
        /// Get/Sets whether automatically hides the handles except when the mouse hovers over the element.
        /// </summary>
        [jQueryOption("autoHide")]
        public bool? AutoHide { get; set; }

        /// <summary>
        /// Gets/Sets prevents resizing if you start on elements matching the selector.
        /// </summary>
        [jQueryOption("cancel")]
        public string DisableResizableElements { get; set; }


        /// <summary>
        /// Gets/Sets the Control/Element constrains dragging to within the bounds of the specified Control/Element.
        /// </summary>
        [jQueryOption("containment")]
        public string Containment { get; set; }

        /// <summary>
        /// Tolerance, in milliseconds, for when resizing should start. If specified, resizing will not start until 
        /// after mouse is moved beyond duration. This can help prevent unintended resizing when clicking on an element.
        /// </summary>
        [jQueryOption("delay")]
        public int? StartDelay { get; set; }

        /// <summary>
        /// Tolerance, in pixels, for when resizing should start. If specified, resizing will not start until after mouse is
        /// moved beyond distance. This can help prevent unintended resizing when clicking on an element.
        /// </summary>
        [jQueryOption("distance")]
        public int? StartDistance { get; set; }


        /// <summary>
        /// Gets/Sets a semi-transparent helper element is shown for resizing.
        /// </summary>
        [jQueryOption("ghost")]
        public bool? ShowSemiTransparentHelper { get; set; }

        /// <summary>
        /// Gets/Sets snaps the resizing helper to a grid  every x pixels
        /// </summary>

        /// <summary>
        /// If specified as a string, should be a comma-split list of any of the following: 'n, e, s, w, ne, se, sw, nw, all'. 
        /// The necessary handles will be auto-generated by the plugin.
        /// If specified as an object, the following keys are supported: { n, e, s, w, ne, se, sw, nw }. 
        /// The value of any specified should be a jQuery selector matching the child element of the resizable to use
        /// as that handle. If the handle is not a child of the resizable, you can pass in the DOMElement or a valid jQuery 
        /// object directly.
        /// </summary>
        [jQueryOption("handlers")]
        public string[] Handles { get; set; }

        /// <summary>
        /// Gets/Sets the css class that will be added to a proxy element to outline the resize 
        /// during the drag of the resize handle. Once the resize is complete, the original element is sized.
        /// </summary>
        [jQueryOption("helper")]
        public string HelperCssClass { get; set; }

        /// <summary>
        /// Gets/Sets the maximum height the resizable should be allowed to resize to.
        /// </summary>
        [jQueryOption("maxHeight")]
        public int? MaxHeight { get; set; }

        /// <summary>
        /// Gets/Sets the maximum width the resizable should be allowed to resize to.
        /// </summary>
        [jQueryOption("maxWidth")]
        public int? MaxWidth { get; set; }

        /// <summary>
        /// Gets/Sets  the minimum height the resizable should be allowed to resize to.
        /// </summary>
        [jQueryOption("minHeight")]
        public int? MinHeight { get; set; }

        /// <summary>
        /// Gets/Sets  the minimum width the resizable should be allowed to resize to.
        /// </summary>
        [jQueryOption("minWidth")]
        public int? MinWidth { get; set; }

        [jQueryOption("grid")]
        public int[] Grid { get; set; }

        /// <summary>
        /// This event is triggered at the start of a resize operation
        /// </summary>
        [jQueryOption("start", ValueType = JavaScriptTypes.Function, FunctionParams = new string[] { "event", "ui" })]
        public string OnResizeStart { get; set; }

        /// <summary>
        /// This event is triggered during the resize, on the drag of the resize handler
        /// </summary>
        [jQueryOption("resize", ValueType = JavaScriptTypes.Function, FunctionParams = new string[] { "event", "ui" })]
        public string OnResize { get; set; }

        /// <summary>
        /// This event is triggered at the end of a resize operation
        /// </summary>
        [jQueryOption("stop", ValueType = JavaScriptTypes.Function, FunctionParams = new string[] { "event", "ui" })]
        public string OnResizeStop { get; set; }

    }
}
